Skip to content

⚡ Bolt: [performance improvement] Cache RegExp instances to prevent recompilation#117

Open
JustLookAtNow wants to merge 1 commit intomasterfrom
bolt-optimize-regexp-caching-13672138189137458869
Open

⚡ Bolt: [performance improvement] Cache RegExp instances to prevent recompilation#117
JustLookAtNow wants to merge 1 commit intomasterfrom
bolt-optimize-regexp-caching-13672138189137458869

Conversation

@JustLookAtNow
Copy link
Owner

💡 What

Extracted several dynamically compiled RegExp instances into static final or top-level final variables across API adapters and UI widgets:

  1. Size parsing regex in NexusPHPWebAdapter.
  2. HTML URL parsing regex in NexusPHPWebAdapter.
  3. Whitespace trimming regex in NexusPHPAdapter.
  4. Page title parsing regex in WebLoginWidget.

🎯 Why

In Dart, dynamically constructing RegExp instances inside loops (such as parsing multiple sections/categories or traversing DOM trees inside isolates) incurs a performance penalty due to repeated pattern compilation. Caching them eliminates this overhead.

📊 Impact

  • Eliminates redundant RegExp compilations during JSON and HTML parsing.
  • Improves parsing speed, particularly for large torrent search results processed within isolates.
  • Reduces CPU usage during the testConnection and getDetail processes.

🔬 Measurement

Run the project's test suite and benchmarks to verify parsing logic remains correct. The tests passed successfully via flutter test.


PR created automatically by Jules for task 13672138189137458869 started by @JustLookAtNow

…ecompilation

Co-authored-by: JustLookAtNow <12379683+JustLookAtNow@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant